package com.mtzqc.common.rv.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding
import com.mtzqc.common.rv.holder.VBViewHolder

abstract class VBQuickAdapter<T, VB : ViewBinding> :
    RootQuickAdapter<VB, T, VBViewHolder<VB>>() {
    override fun createXViewHolder(v: VB): VBViewHolder<VB> {
        return VBViewHolder(v)
    }

    abstract fun createVb(
        inflater: LayoutInflater,
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): VB

    override fun createBaseViewHolder(context: Context, parent: ViewGroup, viewType: Int): VB {
        return createVb(LayoutInflater.from(parent.context), context, parent, viewType)
    }
}